/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author dukynguyen
 */
@Entity
@Table(name = "Document", catalog = "eProjectNational_Level_Paper", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Document.findAll", query = "SELECT d FROM Document d"),
    @NamedQuery(name = "Document.findByDocID", query = "SELECT d FROM Document d WHERE d.docID = :docID"),
    @NamedQuery(name = "Document.findByDocMark", query = "SELECT d FROM Document d WHERE d.docMark = :docMark"),
    @NamedQuery(name = "Document.findByDateCreate", query = "SELECT d FROM Document d WHERE d.dateCreate = :dateCreate"),
    @NamedQuery(name = "Document.findByIDelete", query = "SELECT d FROM Document d WHERE d.iDelete = :iDelete")})
public class Document implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @Column(name = "DocID", nullable = false)
    private Integer docID;
    @Lob
    @Column(name = "DocURL", length = 1073741823)
    private String docURL;
    @Column(name = "DocMark", length = 50)
    private String docMark;
    @Column(name = "DateCreate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreate;
    @Column(name = "iDelete")
    private Boolean iDelete;
    @JoinColumn(name = "EvID", referencedColumnName = "EvID")
    @ManyToOne
    private Event event;
    @JoinColumn(name = "Username", referencedColumnName = "Username")
    @ManyToOne
    private Account account;

    public Document() {
    }

    public Document(Integer docID) {
        this.docID = docID;
    }

    public Integer getDocID() {
        return docID;
    }

    public void setDocID(Integer docID) {
        this.docID = docID;
    }

    public String getDocURL() {
        return docURL;
    }

    public void setDocURL(String docURL) {
        this.docURL = docURL;
    }

    public String getDocMark() {
        return docMark;
    }

    public void setDocMark(String docMark) {
        this.docMark = docMark;
    }

    public Date getDateCreate() {
        return dateCreate;
    }

    public void setDateCreate(Date dateCreate) {
        this.dateCreate = dateCreate;
    }

    public Boolean getIDelete() {
        return iDelete;
    }

    public void setIDelete(Boolean iDelete) {
        this.iDelete = iDelete;
    }

    public Event getEvent() {
        return event;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (docID != null ? docID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Document)) {
            return false;
        }
        Document other = (Document) object;
        if ((this.docID == null && other.docID != null) || (this.docID != null && !this.docID.equals(other.docID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Document[docID=" + docID + "]";
    }

}
